package com.valuegroup.smarttodo.data.enums;

public enum FilterEnum {

    MONTHLY("monthly", "月度", 0),
    QUARTER("quarter", "季度", 1),
    YEAR("year", "年度", 2),
    STATUS("status", "状态", 3),
    RANGE_GOAL("range_goal", "范围", 4),
    RANGE_WEEK("range_week", "范围", 5),
    NEARLY_THREE_WEEKS("nearly_three_weeks", "近三周", 6),
    WEEKS("weeks", "周", 7),
    SORT("sort", "排序", 8);

    private String key;
    private String title;
    private int position;

    FilterEnum(String key, String title, int position) {
        this.key = key;
        this.title = title;
        this.position = position;
    }

    public static String getPageTitleForPosition(int position) {
        for (FilterEnum e : FilterEnum.values()) {
            if (e.position == position) {
                return e.getTitle();
            }
        }
        return "";
    }

    public static String getKeyForPosition(int position) {
        for (FilterEnum e : FilterEnum.values()) {
            if (e.position == position) {
                return e.getKey();
            }
        }
        return "";
    }

    public static FilterEnum getEnumForPosition(int position) {
        for (FilterEnum e : FilterEnum.values()) {
            if (e.position == position) {
                return e;
            }
        }
        return FilterEnum.MONTHLY;
    }

    public String getKey() {
        return key;
    }

    public String getTitle() {
        return title;
    }

    public int getPosition() {
        return position;
    }
}
